<?php
session_start();
require_once 'header.php';
function __autoload($className)
	{
    	require_once('class/' . $className . '.class.php');
	}
session::need_member();
session::need_isset($_GET, "orderhistory.php");
$user=session::getuserid();
if(session::is_manager()==TRUE)
{
	
	$ArrGet=$_GET;
	$UserId=intval($ArrGet['userid']);
	$OrderId=intval($ArrGet['orderid']);
}
else if(session::is_member()==TRUE)
{
	$ArrGet=$_GET;
	$OrderId=intval($ArrGet['orderid']);
	$UserId=session::getuserid();
}
else
{
	$checkUser=user::checkSeller($user);
	if($checkUser!="0")
	{
		$ArrGet=$_GET;
		$OrderId=intval($ArrGet['orderid']);
		$UserId=intval($ArrGet["userid"]);
	}
	
}

	$condition=array(
	'orderid' => $OrderId,
	'userid' => $UserId
	);
	
$GetCcInfo=database::LimitQuery('ccinfo',array(
'condition' => $condition,
'order' => 'order by ccid'
));
$plan=$GetCcInfo[0]['site'];
$GetCcInfo=buycc::unhashBase64($plan, $GetCcInfo);
$id=0;
foreach($GetCcInfo as $change)
{
	$cc=$change['ccnumber'];
	$exm=$change['exmonth'];
	$exy=$change['exyear'];
	$ccv=$change['ccv2'];
	$ccnumhash=hash::unhash($cc, $exm, $exy, $ccv);
	$GetCcInfo[$id]['ccnum']=$ccnumhash;
	$CcId=$change['ccid'];
	$agent=$change['site'];
	if(($change['is_vote']=='N')&&($change['status']!='INVALID'))
	{
		$GetCcInfo[$id]['vote']='<img src="images/like.jpg" onclick="javascript:agentRating('."'$CcId','good','$agent'".');" />';
		$GetCcInfo[$id]['disvote']='<img src="images/dislike.gif" onclick="javascript:agentRating('."'$CcId','bad','$agent'".');" />';
		
	}
	else
	{
		$GetCcInfo[$id]['vote']="";
		$GetCcInfo[$id]['disvote']="";
	}
	$id++;
}
require_once('html/orderdetail.php');
?>